package com.itcam.chaning_;

/**
 * Author:Cammy.Wu
 * Date:2024-06-27
 * Description:链式编程例子
 */

public class Demo {

    private String name;
    private int age;

    public Demo setName(String name) {
        this.name = name;
        return this;
    }

    public Demo setAge(int age) {
        this.age = age;
        return this;
    }

    public void introduce() {
        System.out.println("我的名字是：" + name + "，我今年" + age + "岁。");
    }

    public static void main(String[] args) {
        new Demo().setName("Cammy").setAge(23).introduce();
    }
}


